<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>处置申请附加信息页面</title>
<jsp:include page="../../import.jsp" flush="true" />
<jsp:include page="../assParking/assParkCommon.jsp" flush="true" /><!-- 时间格式转换 -->
    <script type="text/javascript" src="<%=path %>/resource/lib/plugins/ajaxfileupload.js"></script>
    <jsp:include page="../assCommFilesUpload.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<div id="pageInTab" class="pageInTab">
				<!-- 页签1：处置申请 -->
				<div tabid="tabA" title="处置申请" lselected="true">
					<form id="dealCar_view">
						<div class="fieldset1 tabel_col clearFix">
							<div class="fieldBox col_33">
								<div class="label">申请人</div>
				                <div class="field">
				                    <span id="applyNm" name="applyNm">&nbsp;</span>
				                </div>
							</div>
				            <div class="fieldBox col_33">
								<div class="label">申请时间</div>
								<div class="field">
									<span id="applyDt" name="applyDt">&nbsp;</span>
								</div>
							</div>
				            <div class="fieldBox col_33">
								<div class="label">拖车标记</div>
								<div class="field">
									<span id="backedFlagCd" name="backedFlagCd">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">处置接收人类型</div>
								<div class="field">
									<select name="buyerTypeCd" id="buyerTypeCd" ligerui="width: 160" validate="{required:true}">
										<option value="" selected>请选择</option>
										<c:forEach items="${buyerTypeList }" var="buyer">
											<c:if test="${buyer.key == '1' || buyer.key == '2' }">
												<option value="${buyer.key }">${buyer.value }</option>
				                            </c:if>
										</c:forEach>
									</select>
								</div>
							</div>
				            <div class="fieldBox col_33 edit_fqr">
								<div class="label">处置金额(元)</div>
								<div class="field">
									<input type="text" id="sellAmt" name="sellAmt" class="ui-textbox" ligerui="width: 160" value="" onchange="updataAmt()">
								</div>
							</div>
				            <div class="fieldBox col_33 show_fqr">
								<div class="label">处置金额(元)</div>
								<div class="field">
									<span id="sellAmt_1" name="sellAmt_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">处置方式</div>
								<div class="field">
									<select name="sellChannelCd" id="sellChannelCd" ligerui="width: 160">
										<option value="" selected>请选择</option>
										<c:forEach items="${sellChannelList }" var="sell">
											<option value="${sell.key }">${sell.value }</option>
										</c:forEach>
									</select>
								</div>
							</div>
							<!-- 个人信息 -->
							<div class="fieldBox col_33 person_edit Hide">
								<div class="label">处置接收人姓名</div>
								<div class="field">
									<input type="text" id="buyerNm" name="buyerNm" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 person_show Hide">
								<div class="label">处置接收人姓名</div>
								<div class="field">
									<span id="buyerNm_1" name="buyerNm_1">&nbsp;</span>
								</div>
							</div>
				            <div class="fieldBox col_33 person_edit Hide">
								<div class="label">处置接收人证件号</div>
								<div class="field">
									<input type="text" id="buyerCd" name="buyerCd" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
				            <div class="fieldBox col_33 person_show Hide">
								<div class="label">处置接收人证件号</div>
								<div class="field">
									<span id="buyerCd_1" name="buyerCd_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 person_edit Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<input type="text" id="buyerTel" name="buyerTel" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 person_show Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<span id="buyerTel_1" name="buyerTel_1">&nbsp;</span>
								</div>
							</div>
							<!-- 企业信息 -->
							<div class="fieldBox col_33 company_edit Hide">
								<div class="label">处置接收企业名称</div>
								<div class="field">
									<input type="text" id="buyerCompanyNm" name="buyerCompanyNm" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label">处置接收企业名称</div>
								<div class="field">
									<span id="buyerCompanyNm_1" name="buyerCompanyNm_1">&nbsp;</span>
								</div>
							</div>
				            <div class="fieldBox col_33 company_edit Hide">
								<div class="label">处置接收企业联系人</div>
								<div class="field">
									<input type="text" id="buyerCompanyContact" name="buyerCompanyContact" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
				            <div class="fieldBox col_33 company_show Hide">
								<div class="label">处置接收企业联系人</div>
								<div class="field">
									<span id="buyerCompanyContact_1" name="buyerCompanyContact_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_edit Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<input type="text" id="buyerCompanyTel" name="buyerCompanyTel" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<span id="buyerCompanyTel_1" name="buyerCompanyTel_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_edit Hide">
								<div class="label">组织机构代码证</div>
								<div class="field">
									<input type="text" id="buyerCompanyCode" name="buyerCompanyCode" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label">组织机构代码证</div>
								<div class="field">
									<span id="buyerCompanyCode_1" name="buyerCompanyCode_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 company Hide">
								<div class="label"></div>
								<div class="field"></div>
							</div>
							<div class="fieldBox col_33 company Hide">
								<div class="label"></div>
								<div class="field"></div>
							</div>
							<!-- 处置信息 -->
				            <div class="fieldBox col_100 edit_fqr">
								<div class="label">处置说明</div>
								<div class="field">
									<textarea name="sellDesc" id="sellDesc" rows="3" class="l-textarea" style="width:98%" value="" ></textarea>
								</div>
							</div>
				            <div class="fieldBox col_100 show_fqr">
								<div class="label">处置说明</div>
								<div class="field">
									<span id="sellDesc_1" name="sellDesc_1">&nbsp;</span>
								</div>
							</div>
							<!-- 上传附件 -->
                            <div class="fieldBox col_100">
                                <div class="label">附件上传</div>
                                <div class="fieldset1 tabel_col clearFix dealFileGrid">
                                    <div class="sqPanel_body">
                                        <div id="dealFileGrid" class="sq-grid"></div>
                                    </div>
                                </div>
                            </div>
                            <!-- 附件显示 -->
                            <div class="fieldBox col_100">
                                <div style="width: 98%; margin-left: 1%;">
                                    <jsp:include page="../assCommFilesList.jsp" flush="true"></jsp:include>
                                </div>
                            </div>
				            <div class="fieldBox col_33 Hide">
								<div class="label">数据类型</div>
								<div class="field">
									<select name="dataTypeCd" id="dataTypeCd" ligerui="width: 160">
										<option value="">请选择</option>
										<c:forEach items="${dataTypeList }" var="data">
				                        	<option value="${data.key }">${data.value }</option>
										</c:forEach>
									</select>
								</div>
							</div>
							<div class="edit_fqr" style="text-align: center;line-height: 2.3em;">
								<span id="updateBscInfoBtn" class="sq-button sq-button-round" onclick="saveDealSell('1')">保存</span>
							</div>
							<c:if test="${flag == 4 }">
							<div class="edit" style="text-align: center;line-height: 2.3em;">
								<span id="updateBscInfoBtn" class="sq-button sq-button-round" onclick="saveDealSell('1')">保存</span>
							</div>
							</c:if>
							<div class="fieldBox col_33">
								<div class="label">保底价款(元)</div>
				                <div class="field">
				                    <span id="baseAmt" name="baseAmt">&nbsp;</span>
				                </div>
							</div>
				            <div class="fieldBox col_66">
								<div class="field">
									<input id="isReceived" name="isReceived" value="" type="checkbox" class="liger-checkbox" /> 未到账 
								</div>
							</div>
							<div class="fieldBox col_33 edit_cwqr hide_abc">
								<div class="label">实际到账金额(元)</div>
								<div class="field">
									<input name="receivedAmt" id="receivedAmt" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_cwqr">
								<div class="label">实际到账金额(元)</div>
								<div class="field">
									<span id="receivedAmt_1" name="receivedAmt_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_cwqr hide_abc">
								<div class="label">实际到账时间</div>
								<div class="field">
									<input name="receivedTm" id="receivedTm" value="" type="text" class="ui-datepicker" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_cwqr">
								<div class="label">实际到账时间</div>
								<div class="field">
									<span id="receivedTm_1" name="receivedTm_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">处置评估价</div>
								<div class="field">
									<input type="text" id="sellEstiAmt" name="sellEstiAmt" class="ui-textbox" ligerui="width: 160" value="${sellEstiAmt}" onchange="updataAmt()">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
                   			<div class="fieldBox col_33" > 
				                <div class="label">处置评估时间</div>
				                <div class="field">
				                     <input name="stDt" id="stDt" type="text" class="ui-datepicker" value="" ligerui="width: 160" >
				                     <span class="requiredSymbol">*</span>
				                </div>
			            	</div>
			            	<div class="fieldBox col_33">
								<div class="label"></div>
								<div class="field"></div>
							</div>
							<div class="fieldBox col_33">
								<div class="label"></div>
								<div class="field"></div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">处置金额/处置评估价</div>
								<div class="field">
									<span id="sellEstiAmt_1" name="sellEstiAmt_1" ligerui="width: 300">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 ">
								<div class="label">处置金额/保底价</div>
								<div class="field">   
									<span id="baseAmt_1" name="baseAmt_1" ligerui="width: 160">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label"></div>
								<div class="field"></div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">含小贷保底价合计(元)</div>
								 <div class="field">
								<span id="baseAllAmt" name="baseAllAmt">${baseAllAmt/100}</span>
								 </div>
							</div>
							<div class="fieldBox col_33">
								<div class="label"></div>
								<div class="field"></div>
							</div>
							<div class="fieldBox col_100">
								<div class="edit_cwqr" style="text-align: center;line-height: 3em;">
									<span id="updateSsInfoBtn" class="sq-button sq-button-round" onclick="saveDealSell('2')">保存到账信息</span>
								</div>
							</div>
							<div class="caption">
								<span class="title">亏损原因</span>
							</div>
                            <div class="fieldBox col_100">
                                <c:forEach items="${lossCauseCdJosn}" var="lossCauseCd" varStatus="index">
                                    <input id="lossCauseCd${lossCauseCd.key}" type="checkbox" value="${lossCauseCd.key}"
                                           name="lossCause" onchange="disabledOther()" />${lossCauseCd.value}
                                    <c:if test="${lossCauseCd.key == '006'}">
                                        <input type="text" id="costRem" name="costRem" class="ui-textbox" value=""
                                               placeholder="备注"/>
                                    </c:if>
                                </c:forEach>
                                <div class="btnsBox">
                                    <span id="updateLossBtn" class="sq-button sq-button-round" onclick="addAssDealSellLoss()">保存亏损原因</span>
                                </div>
                            </div>
							<!-- 付款信息-处置收款表 -->
							 <div class="caption">
								<span class="title">付款方</span>
							</div> 
							<div class="fieldBox col_100">
								<div class="sqPanel">
									<div id="detailGrid">
										<div style="text-align: right;line-height: 2.3em;" class="edit_gps_st">
											<c:if test="${flag == '7' || flag == '18' }">
												<span id="editPayInfo" class="sq-button sq-button-round" onclick="editPayInfo('')">添加</span>
											</c:if>
										</div>
										<!-- 实际到账信息列表显示块 -->
										<div id="ligergrid2" class="sq-grid"></div>
									</div>
								</div>
							</div>
								<!-- 来款凭证上传附件 -->
							<c:if test="${flag == '7' || flag == '18' }">
							<div class="fieldBox col_100">
								<div class="label">来款凭证上传</div>
								<div class="field">
									<div id="fileUpload2" class="upfileBoxs"></div>
									<span class="sq-button sq-button-hasicon" id="btnUpload2" onclick="ajaxFileUploadImg('uploads2',2)">
										<i class="sqBtnIco_9"></i>上传
									</span>
								</div>
							</div>
							</c:if>
							<!-- 来款凭证附件显示 -->
							<div class="fieldBox col_100">
								<div style="width: 98%; margin-left: 1%;">
									<div id="ligergrid_file2" class="sq-grid"></div>
								</div>
							</div>
							<c:if test="${flag == '7' || flag == '18' }">
							<div class="btnsBox">
							  <span id="savePayInfoFileBtn" class="sq-button sq-button-round" onclick="javascript:saveFile('lkpz_cz')">保存</span>
							</div>
							</c:if>
							
							
							<!-- 收款信息 -->
							<div class="caption">
								<span class="title">收款方</span>
							</div>
							<div class="fieldBox col_33 edit_tzdk">
								<div class="label">收款银行</div>
								<div class="field">
									<input name="payeeBankNm" id="payeeBankNm" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_tzdk">
								<div class="label">收款银行</div>
								<div class="field">
									<span id="payeeBankNm_1" name="payeeBankNm_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_tzdk">
								<div class="label">收款账号</div>
								<div class="field">
									<input name="payeeAccNo" id="payeeAccNo" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_tzdk">
								<div class="label">收款账号</div>
								<div class="field">
									<span id="payeeAccNo_1" name="payeeAccNo_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_tzdk">
								<div class="label">收款方名称</div>
								<div class="field">
									<input name="payeeAccNm" id="payeeAccNm" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_tzdk">
								<div class="label">收款方名称</div>
								<div class="field">
									<span id="payeeAccNm_1" name="payeeAccNm_1">&nbsp;</span>
								</div>
							</div>
							<!-- 提车人信息 -->
							<div class="caption">
								<span class="title">提车人信息</span>
							</div>
							<div class="fieldBox col_33 edit_tcr">
								<div class="label">提车人姓名</div>
								<div class="field">
									<input name="pickCarNm" id="pickCarNm" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_tcr">
								<div class="label">提车人姓名</div>
								<div class="field">
									<span id="pickCarNm_1" name="pickCarNm_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_tcr">
								<div class="label">提车人联系电话</div>
								<div class="field">
									<input name="pickCarTel" id="pickCarTel" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_tcr">
								<div class="label">提车人联系电话</div>
								<div class="field">
									<span id="pickCarTel_1" name="pickCarTel_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_tcr">
								<div class="label">提车人身份证号</div>
								<div class="field">
									<input name="pickCarCd" id="pickCarCd" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_tcr">
								<div class="label">提车人身份证号</div>
								<div class="field">
									<span id="pickCarCd_1" name="pickCarCd_1">&nbsp;</span>
								</div>
							</div>
							<!-- 上传提车人附件 -->
							<div class="fieldBox col_100 edit_tcr">
								<div class="label">附件上传</div>
								<div class="field">
									<div id="fileUpload3" class="upfileBoxs"></div>
									<span class="sq-button sq-button-hasicon" id="btnUpload3" onclick="ajaxFileUploadImg('uploads3',3)">
										<i class="sqBtnIco_9"></i>上传
									</span>
								</div>
							</div>
							<!-- 附件显示 -->
							<div class="fieldBox col_100">
								<div style="width: 98%; margin-left: 1%;">
									<div id="ligergrid_file3" class="sq-grid"></div>
								</div>
							</div>
							<!-- 隐藏支付表主键、支付表号 -->
			                <div class="fieldBox col_100" style="display:none;">
			                    <div class="field">
			                         <input name="tcMasterId" id="tcMasterId" type="text" class="ui-textbox" value="${tcMasterId}">
			                         <input name="tcDetailId" id="tcDetailId" type="text" class="ui-textbox" value="${tcDetailId}">
			                         <input name="infoId" id="infoId" type="text" class="ui-textbox" value="${infoId}">
			                         <input name="cstId" id="cstId" type="text" class="ui-textbox" value="${cstId}">
			                         <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="${cstNm}">
			                         <input name="orgName" id="orgName" type="text" class="ui-textbox" value="${orgName}">
			                         <input name="buOrgCd" id="buOrgCd" type="text" class="ui-textbox" value="${buOrgCd}">
			                         <input name="deal_Id" id="deal_Id" type="text" class="ui-textbox" value="${deal_Id}">
	                         		 <input name="processId" id="processId" type="text" class="ui-textbox" value="${processId}">
			                         <input name="taskDefKey" id="taskDefKey" type="text" class="ui-textbox" value="${taskDefKey}">
	                         		 <input name="flag" id="flag" type="text" class="ui-textbox" value="${flag }">
	                         		 <input name="assDealRecAmt_id" id="assDealRecAmt_id" type="text" class="ui-textbox" value="${assDealRecAmt_id }">
			                         <!-- 上传文件使用：系统时间和当前登录人姓名 -->
			                         <input name="sysDate" id="sysDate" type="text" class="ui-textbox" value="${sysDate }">
			                         <input name="loginUsrNm" id="loginUsrNm" type="text" class="ui-textbox" value="${loginUsrNm }">
			                    </div>
			                </div>
						</div>
						<div class="btnsBox saveBtn">
							<span id="saveDealSellBtn" class="sq-button sq-button-round" onclick="saveDealSell('4')">保存基本信息</span>
						</div>
					</form>

					<%--绑定资金--%>
					<%--<jsp:include page="../../capital/capFund/capFundAddInFlow.jsp" flush="true">
						<jsp:param name="relationBizId" value="${paySchId}"/>
						<jsp:param name="isDetail" value="${isDetail}"/>
						<jsp:param name="isShowStlDt" value="0"/>
					</jsp:include>--%>
					<c:if test="${bizTyp=='3' }">
						<jsp:include page="../../capital/capFund/capFundAddBind.jsp" flush="true"></jsp:include>
					</c:if>
				</div>
				<!-- 页签2：拖车单信息 -->
				<div tabid="tabB" title="拖车单信息" id="tabBId" style="">
					<iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
				</div>
			</div>
		</div>
	</div>

    <script>
	    var pageInApp={
			flag:false //tab页验证关闭
		};//to下一级子窗口 接口
		var pageInTab=null;//页签
		var SZSH = "${SZSH}";//控制显示或者编辑亏损信息

		//是否隐藏：付款方的操作
		var isDetail = '${isDetail}';
		var isShow_flag = (isDetail == '0');
		var l_hidden = isShow_flag ? "l-hidden" : "";

        var dealId = $("#deal_Id").val();

        var flag = $("#flag").val();

	    $(function() {
	    	initForm();//初始化表单
	        initTab();//初始化页签
	        initData();//初始化数据
	        //initRecData();//初始化处置收款信息
	        //showOrEdit();//显示还是编辑
            showAssDealSellLoss();//初始化编辑亏损信息列表
	        if(SZSH!="1"){
                //隐藏保存按钮
                $("#updateLossBtn").hide();
	        }
	    	//loadFilesLiger("tccz", 1, $("#deal_Id").val());//加载处置申请文件列表信息
	    	loadFilesLiger("cztcr", 3, $("#deal_Id").val());//加载处置提车人文件列表信息
	    	loadFilesLiger("lkpz_cz", 2, $("#deal_Id").val());//加载来款凭证文件列表信息
            initDealFileGrid();
	    });

        var dealFileGrid = null;

        // 维护过户方案资料Grid
        function initDealFileGrid() {
            dealFileGrid = $("#dealFileGrid").ligerGrid({
                url: '<%=path%>/ass/assDealSell/initDealFileGrid.do?id=' + dealId + '&cfgCd=ASS008',
                method: 'get',
                columns: [
                    {display: '资料名称', name: 'datNm', align: 'center', minWidth: 100, enabledSort: false},
                    {
                        display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                        render: function (rowdata, rowindex, value) {
                            if (value) {
                                var h;
                                h = '<a href="javascript:uploadFileByUrl(';
                                h += "'" + rowdata.filePath + "'";
                                h += ",'" + rowdata.fileNm + "'";
                                h += ')">' + rowdata.fileNm + '</a>'
                                return h;
                            }
                        }
                    },
                    {
                        display: '上传时间',
                        name: 'crtTm',
                        align: 'center',
                        width: 150,
                        enabledSort: false,
                        render: renderDate
                    },
                    {
                        display: '操作', name: 'operate', minWidth: 100, align: 'center', enabledSort: false,
                        render: function (rowdata, rowindex, value) {
                            if ("7" == flag || "18" == flag) {
                                var h = '';
                                h += '<a class="sq-button-hasicon uploadFile" style="cursor:pointer;" onclick="uploadFile(\'' + rowdata.cfgCd + '\', \'' + rowdata.cfgDtlCd + '\')"><i class="sqBtnIco_9"></i>上传</a><span class="sq-button sq-button-round fileupload-button" style="display: none;">上传<input type="file" id="uploadInput_' + rowdata.cfgCd + '_' + rowdata.cfgDtlCd + '" multiple name="fileup_' + rowdata.cfgCd + '_' + rowdata.cfgDtlCd + '"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\'' + rowdata.cfgCd + '\',\'' + rowdata.cfgDtlCd + '\',\'' + rowdata.orgCd + '\');"></span>';
                                if ('' != rowdata.fileId && null != rowdata.fileId) {
                                    h += '<a class="sq-button-hasicon delFile" id="delFile_' + rowdata.cfgDtlCd + '" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                }
                                return h;
                            }
                        }
                    }
                ],
                root: 'rows',
                hideLoadButton: true,
                width: '100%',
                height: '200px',
                isScroll: false,
                rownumbers: true,  //显示序号
                checkbox: false,
                allowUnSelectRow: true,
                alternatingRow: false,
                frozen: false,
                usePager: false,
                onAfterShowData: function () {
                    $('#dealFileGrid').rowspan('datNm');
                    $('#dealFileGrid').rowspan('operate');
                },
            });
        }

        /**
         * 上传文件
         * @param e
         * @param cfgCd
         * @param cfgDtlCd
         * @param orgCd
         */
        function onChangefile_multi(e, cfgCd, cfgDtlCd, orgCd) {
            var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            var filePath = "";
            filePath = "assDealFile";
            $.ajaxFileUpload({
                url: '<%=path%>/system/sysulfilesrec/upload.do',
                secureuri: false,
                fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
                dataType: 'json',
                data: {filePath: filePath},
                success: function (msg) {
                    if (msg.success == 1) {
                        $.ajax({
                            type: 'post',
                            dataType: 'json',
                            data: {
                                'fileParams': JSON.stringify(msg.data),
                                'id': dealId,
                                'cfgCd': cfgCd,
                                'cfgDtlCd': cfgDtlCd,
                                'orgCd': orgCd
                            },
                            url: '<%=path%>/ass/assDealSell/uploadDealFile.do',
                            success: function (msg) {
                                if (msg.success == 1) {
                                    dealFileGrid.reload();
                                } else {
                                    $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                                }
                                $.ligerDialog.hide();
                            }
                        });
                    } else {
                        wait_dialog.close();
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        };

        // 上传文件a标签链接到input标签上
        function uploadFile(cfgCd, cfgDtlCd) {
            document.getElementById("uploadInput_" + cfgCd + "_" + cfgDtlCd).click();
        }

        // 格式化时间
        function renderDate(rowdata, index, value) {
            var dateStr = "";
            if (null != value) {
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
            }
            return dateStr;
        }

		 var flags = "${flag}";
		//初始化表单
		function initForm(){
	    	$("#dealCar_view").ligerForm({
				validate: true
			});
			$("#dealCar_view").check_ligerFormEditor();//重新刷新页面动态字段
			//初始化处置接受人类型-change方法
			liger.get('buyerTypeCd').bind('changeValue', function () {
				selectChange();
			});
			//初始化未到账-change方法
			$("#isReceived").change(function () {
	            if (this.checked) {
	                $(this).val("1");//未到账
	            } else {
					$(this).val("0");//已到账
	            }
	        });
		};
	    
		//初始化Tab页签
		function initTab(){
			var crflag = "";
			var flag = $("#flag").val();
			if(flag == "10"){//资产管理员出库登记
				crflag = "out";//出库
			}else{
				crflag = "detail";//查看
			}
			pageInTab = $("#pageInTab").ligerTab({
				height: 'auto',
				contextmenu: false,
				minIframeHeight: GET_minIframeHeight(),
				onAfterSelectTabItem: function(tabid) {
					//获取拖车主表ID和明细表ID供其它页面使用
					var tcMasterId = $("#tcMasterId").val();
					var tcDetailId = $("#tcDetailId").val();
					var busid= $("#deal_Id").val();
					var processId= $("#processId").val();
					var taskDefKey= $("#taskDefKey").val();
					if(tabid!="tabA"){
						if(!tcDetailId || !tcMasterId){
							$.ligerDialog.SQalert({content: "抱歉信息不存在！", SQ_type: "warning"});
							return false; //验证不通过，不执行以下代码
						}
					}
					switch (tabid){
						case "tabB":
							if(flag == "8"||flag == "12"){
								pageInTab.setTabItemSrc(tabid, "<%=path%>/ass/assTrailCarM/toInfoViewPage.do?mdfSellCost=${mdfSellCost}&tcMasterId="+tcMasterId+"&tcDetailId="+tcDetailId+"&crflag="+crflag+"&busid="+busid+"&processId="+processId+"&taskDefKey="+taskDefKey);
								break;
							}else{
								pageInTab.setTabItemSrc(tabid, "<%=path%>/ass/assTrailCarM/toInfoViewPage.do?mdfSellCost=${mdfSellCost}&tcMasterId="+tcMasterId+"&tcDetailId="+tcDetailId+"&crflag="+crflag);
								break;
								
							}
					}
					SetIframe_height();
				}
			});
			//设置页签
			$.extend(true, pageInApp, {
				pageInTab: pageInTab
			});
		};

		function showAssDealSellLoss() {
            $.ajax({
                type: 'get',
                dataType:'json',
                url:'<%=path%>/ass/assTrailCarD/getAssDealSellLossList.do?dataId='+$("#deal_Id").val(),
                success:function(data){
                    //wait_dialog.close();
                    if(data){
                        setLossData(data);//设置数据
                    }else{
                        $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
                    }
                }
            });
        }

        // 若选择其他原因则置灰其他的复选框
        function disabledOther() {
            var chk_value = [];//定义一个数组
            $("input[name='lossCause']:checkbox").each(function () {//遍历每一个名字为nodes的复选框，其中选中的执行函数
                if ($(this).prev().attr('class').indexOf('l-checkbox-checked') !== -1) {
                    chk_value.push($(this).val());//将选中的值添加到数组chk_value中
                }
            });
            var isOtherChecked;
            for (var chkVal of chk_value) {
                isOtherChecked = $("#lossCauseCd006").is(':checked');
            }
            var lossJson = ${lossCauseCdJosn};
            if (isOtherChecked) {
                for (var val of lossJson) {
                    if ("006" != val.key) {
                        liger.get("lossCauseCd" + val.key).setDisabled(true);
                    }
                }
            } else {
                for (var val of lossJson) {
                    if ("006" != val.key) {
                        liger.get("lossCauseCd" + val.key).setEnabled(true);
                        $("#lossCauseCd" + val.key).removeAttr("checked");
                    }
                }
            }
        }

        // 设置亏损原因数据
        function setLossData(data) {
		    var costRem;
		    for (var loss of data) {
                $("input[name='lossCause']").each(function () {
                    if ($(this).val() == loss.lossCauseCd) {
                        $(this).ligerGetCheckBoxManager().setValue(true);
                    }
                });
                costRem = loss.costRem;
            }
		    liger.get("costRem").setValue(costRem);
            disabledOther();
        }
		
		//初始化数据
	    function initData(){
	    	var dealId = $("#deal_Id").val();
	    	if(!dealId){
	    		$.ligerDialog.SQalert({content: "拖车处置主表ID为空,无法查询相关信息！",SQ_type: "error"});
	    		return;
	    	}
	    	//var wait_dialog= $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_LOADING,SQ_type: "waitting"};
	    	//加载处置主表信息
	    	var _url = '<%=path%>/ass/assTrailCarD/getDealInfoById.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{dealId:dealId},
	    		url: _url,
	    		success:function(msg){
	    			 //wait_dialog.close();
	    			 if(msg.success == 1){
	    				 if(null != msg.data){
	    				 	setData(msg.data);//设置数据
	    				 }
	    			 }else{
	    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	    			 }
	    		}
	    	});
	    }

	    //设置页面数据
	    function setData(data){
	    	//加载表单
	    	var form = liger.get("dealCar_view");
			form.setData({
				buyerTypeCd: data.buyerTypeCd,
				sellAmt: data.sellAmt / 100,
				sellChannelCd: data.sellChannelCd,
				buyerNm: data.buyerNm,
				buyerCd: data.buyerCd,
				buyerTel: data.buyerTel,
				buyerCompanyNm: data.buyerCompanyNm,
				buyerCompanyContact: data.buyerCompanyContact,
				buyerCompanyTel: data.buyerCompanyTel,
				buyerCompanyCode: data.buyerCompanyCode,
				sellDesc: data.sellDesc,
				dataTypeCd: data.dataTypeCd,//数据类型
				isReceived: data.isReceived,
				receivedAmt: data.receivedAmt / 100,
				receivedTm: renderDate1(data.receivedTm),
				payeeAccNm: data.payeeAccNm,
				payeeBankNm: data.payeeBankNm,
				payeeAccNo: data.payeeAccNo,
				pickCarNm: data.pickCarNm,
				pickCarTel: data.pickCarTel,
				pickCarCd: data.pickCarCd,
				//sellEstiAmt:data.sellEstiAmt/100,//处置评估价
				stDt:data.sellEstiDt//处置评估时间
	    	});
			  if( flags != 4 ){
				if (liger.get("sellEstiAmt")) {
					 liger.get("sellEstiAmt").setDisabled(true);
					 }
				if (liger.get("stDt")) {
					 liger.get("stDt").setDisabled(true);
					 }
				if (liger.get("sellEstiAmt_1")) {
					 liger.get("sellEstiAmt_1").setDisabled(true);
					 }
				if (liger.get("baseAmt_1")) {
					 liger.get("baseAmt_1").setDisabled(true);
					 }
			} 
			var formSet1=liger.get("dealCar_view");
			if(flags == 4){//驳回页面，动态控制字段必填项
				formSet1.setFieldValidate("sellEstiAmt", {
				                    required: true,
				                    passport: false,
				                    select: false
				 });
				formSet1.setFieldValidate("stDt", {
				                    required: true,
				                    passport: false,
				                    select: false
				 });
			}else{
				formSet1.setFieldValidate("sellEstiAmt", {
                    required: false,
                    passport: false,
                    select: false
            });
				formSet1.setFieldValidate("stDt", {
                    required: false,
                    passport: false,
                    select: false
            });
			}
			
			
			//加载日期插件
			$("#receivedTm").trigger("change");
			$('#isReceived').ligerCheckBox();
			//显示基本信息
			$("#applyNm").html(data.applyNm);
 	    	$("#applyDt").html(renderDate1(data.crtTm));
			$("#backedFlagCd").html(data.backedFlagCd);
			$("#baseAmt").html(data.baseAmt / 100);
			$("#receivedAmt_1").html(data.receivedAmt / 100);
 	    	$("#receivedTm_1").html(renderDate1(data.receivedTm));
 	    	if(data.sellEstiAmt == null){
 	    		$("#sellEstiAmt_1").html(0+"%");//处置金额/市场评估价
 	    	}else{
 	    		 var result = (( data.sellAmt / 100)/data.sellEstiAmt/100)*100+"";
 	    		var last_result=Number(result.toString().match(/^\d+(?:\.\d{0,2})?/)) ; 
	    		$("#sellEstiAmt_1").html(last_result+"%"); //处置金额/市场评估价
 	    	}
 	    	if(data.sellAmt == null){
 	 	    	$("#baseAmt_1").html(0+"%");//处置金额/保底价 
 	    	}else{
 	    		 var result = ((data.sellAmt / 100)/(data.baseAmt / 100))*100;
 	    		var last_result=Number(result.toString().match(/^\d+(?:\.\d{0,2})?/)) ; 
 	    		 //var last_result = result.substring(0,result.indexOf(".") + 3);
 	 	    	$("#baseAmt_1").html(last_result+"%"); //处置金额/保底价 
 	    	} 
 	    	//设置显示信息
			$("#sellAmt_1").html(data.sellAmt / 100);
			$("#buyerNm_1").html(data.buyerNm);
			$("#buyerCd_1").html(data.buyerCd);
			$("#buyerTel_1").html(data.buyerTel);
			$("#buyerCompanyNm_1").html(data.buyerCompanyNm);
			$("#buyerCompanyContact_1").html(data.buyerCompanyContact);
			$("#buyerCompanyTel_1").html(data.buyerCompanyTel);
			$("#buyerCompanyCode_1").html(data.buyerCompanyCode);
			$("#sellDesc_1").html(data.sellDesc);
			$("#payeeAccNm_1").html(data.payeeAccNm);
			$("#payeeBankNm_1").html(data.payeeBankNm);
			$("#payeeAccNo_1").html(data.payeeAccNo);
			$("#pickCarNm_1").html(data.pickCarNm);
			$("#pickCarTel_1").html(data.pickCarTel);
			$("#pickCarCd_1").html( data.pickCarCd);
			$("#sellEstiAmt").html( data.sellEstiAmt/100);//处置评估价
			$("#stDt").html( data.sellEstiDt);//处置评估时间
			
 	    	//设置拖车信息主键值
 	    	$("#tcMasterId").val(data.masterId);
			$("#tcDetailId").val(data.detailId);
	    }
	  	//初始化处置收款表数据
	    function initRecData(){
	    	var dealId = $("#deal_Id").val();
	    	if(!dealId){
	    		$.ligerDialog.SQalert({content: "拖车处置主表ID为空,无法查询相关信息！",SQ_type: "error"});
	    		return;
	    	}
	    	//var wait_dialog= $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_LOADING,SQ_type: "waitting"};
	    	//加载处置收款表信息
	    	var _url = '<%=path%>/ass/assTrailCarM/getAssDealRecAmtList.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{dataId:dealId, dataTypeCd:"1"},
	    		url: _url,
	    		success:function(msg){
	    			 //wait_dialog.close();
	    			 if(msg.success == 1){
	    				 if(null != msg.data){
		    				 setRecData(msg.data);//设置数据
	    				 }
	    			 }else{
	    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	    			 }
	    		}
	    	});
	    }
	
	    //设置页面数据
	    function setRecData(data){
	    	//加载表单
	    	var form = liger.get("dealCar_view");
			form.setData({
				payerBankNm: data.payerBankNm,
				payerAccNo: data.payerAccNo,
				payerAccNm: data.payerAccNm,
				fReceivedAmt: data.receivedAmt / 100,
				fReceivedTm: renderDate1(data.receivedTm)
	    	});
			//加载日期插件
			$("#fReceivedTm").trigger("change");
			//显示付款方信息
			$("#payerBankNm_1").html(data.payerBankNm);
			$("#payerAccNo_1").html(data.payerAccNo);
			$("#payerAccNm_1").html(data.payerAccNm);
			$("#fReceivedAmt_1").html(data.receivedAmt / 100);
 	    	$("#fReceivedTm_1").html(renderDate1(data.receivedTm));
 	    	//设置处置收款表主键值
 	    	$("#assDealRecAmt_id").val(data.id);
	    }
		
		//处置接受人类型
		function selectChange(){
			var buyerTypeCd_val=$("#buyerTypeCd").val();
            var formSet1=liger.get("dealCar_view");
            if (buyerTypeCd_val == "") {
				$("#dealCar_view").find(".company_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#dealCar_view").find(".person_edit").each(function (){
	        		$(this).addClass('Hide');
	        	});
            }else if (buyerTypeCd_val == "1") {//企业
				$("#dealCar_view").find(".company_edit").each(function (){
	        		$(this).removeClass('Hide');
	        	});
				$("#dealCar_view").find(".person_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				//取消个人《必选》验证规则
                formSet1.setFieldValidate("buyerNm", {required: false});
                formSet1.setFieldValidate("buyerCd", {required: false});
                formSet1.setFieldValidate("buyerTel", {required: false});
				//设置企业《必选》验证规则
                formSet1.setFieldValidate("buyerCompanyNm", {required: true});
                formSet1.setFieldValidate("buyerCompanyContact", {required: true});
                formSet1.setFieldValidate("buyerCompanyTel", {required: true});
                formSet1.setFieldValidate("buyerCompanyCd", {required: true});
            }else if (buyerTypeCd_val == "2") {//个人
				$("#dealCar_view").find(".person_edit").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#dealCar_view").find(".company_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				//取消企业《必选》验证规则
                formSet1.setFieldValidate("buyerCompanyNm", {required: false});
                formSet1.setFieldValidate("buyerCompanyContact", {required: false});
                formSet1.setFieldValidate("buyerCompanyTel", {required: false});
                formSet1.setFieldValidate("buyerCompanyCd", {required: false});
				//设置个人《必选》验证规则
                formSet1.setFieldValidate("buyerNm", {required: true});
                formSet1.setFieldValidate("buyerCd", {required: true});
                formSet1.setFieldValidate("buyerTel", {required: true});
            }
            showOrEdit();//设置编辑显示属性
		}
		 //设置页面数据：处置金额/处置评估价   |  处置金额/保底价
		  function updataAmt(){
			  var sellAmt = 0;
			  sellAmt = document.getElementById("sellAmt").value;
			  var sellEstiAmt =0;
			  sellEstiAmt = document.getElementById("sellEstiAmt").value;
			  var baseAmt ="${baseAmt}";
			 if(sellAmt!= "" && sellEstiAmt != ""){
				 var result = ((sellAmt)/sellEstiAmt/100)*100+"";
				 var last_result=Number(result.toString().match(/^\d+(?:\.\d{0,2})?/)) ; 
				$("#sellEstiAmt_1").html(last_result+"%");//处置金额/市场评估价
			 }
			 if(sellAmt!= "" && baseAmt != ""){
				 var result =(sellAmt/(baseAmt/100))*100+"";
				 var last_result=Number(result.toString().match(/^\d+(?:\.\d{0,2})?/)) ; 
	 	 	    $("#baseAmt_1").html(last_result+"%");//处置金额/保底价 
			 }
		  }
		//保存文件-获取对应上传组件的文件列表
		function saveFile(type){
			var index = 1;//处置申请附件
			var eflag = "tccz";
			var flag = $("#flag").val();
			if((flag == "7" || flag == "9") && type != 'lkpz_cz'){
				index = 3;//提车人附件
				eflag = "cztcr";
			}
			if((flag == '7' || flag == '18') && type == 'lkpz_cz'){
				index = 2;//来款凭证附件
				eflag = "lkpz_cz";
			}
			var docArray = JSON.stringify(getUploadResultParams(index));
	        var url = "<%=path%>/ass/assTrailCarD/uploadAttchment.do";
	        var dealId = $("#deal_Id").val();
        	if(null == docArray){
        		return false;
        	}else{
		        if(dealId){//拖车主表ID不为空执行
			        //赋值附件
			        var data = {
						"docArray": docArray,
						"pkId": dealId,
						"flag": eflag
					};
					//请求
			        AjaxUtils.ajaxPost(url, data, function(msg){
			        	if(msg.success == 1){
							 if(msg.data){
								 //刷新附件页面GRID方法和清空上传按钮
								 refreshUlFileRecList(index);
								 clearUploadResultParams(index);
							 }
						 }else{
							 UIUtils.alertError(msg.info);
						 }
			        }, true);
		        }else{
		        	$.ligerDialog.SQalert({content: "业务主键为空-不能保存文件！",SQ_type: "error"});
		        }
        	}
		}
		
		//显示已上传但是未保存的文件列表
		function showFiles(data, index){
			var sysDate = $("#sysDate").val();
			var loginUsrNm = $("#loginUsrNm").val();
			var f_Grid = liger.get("ligergrid_file"+index);
			var uploadJOSN = data;
    		for (var i=0; i< uploadJOSN.length; i++){ 
        		//添加行-追加行
        		f_Grid.addRow({fileNm: uploadJOSN[i].fileNm, crtUsrRlNm: loginUsrNm, crtTm: sysDate, doSthFlag: "1", ligerIndex: index,id:i});
    		}
		}
		
		//保存处置申请信息
		function saveDealSell(opFlag){
			var ligerForm = liger.get("dealCar_view");
			if (!ligerForm.valid()) {
				top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
				return false; //验证不通过，不执行以下代码
			}
			//获取处置主表ID
			var dealId = $("#deal_Id").val();
			//获取处置收款表ID
			var assDealRecAmtId = $("#assDealRecAmt_id").val();
			//获取表单数据
			var data = ligerForm.getData();
	    	data["isReceived"]= $("#isReceived").val();
			console.log(data);
			//修改处置信息主表数据
			var wait_dialog = null;
			var url = '';
			if(opFlag == "1" || opFlag == "2" || opFlag == "4"){//发起人-财务确认到账-提车人
				url = '<%=path%>/ass/assTrailCarD/modifyDealInfo.do';
				if(!dealId){//为空提示
					top.$.ligerDialog.SQalert({content: "处置主表ID为空,无法保存！",SQ_type: "warning"});
					return false;
				}
			}else if(opFlag == "3"){//通知打款-处置收款信息
				data["dataId"] = dealId;
				data["dataTypeCd"] = "1";//处置
				url = '<%=path%>/ass/assTrailCarD/updateYCDealInfo.do';
			}else{
				$.ligerDialog.SQalert({content: "操作码无法识别,不能保存！",SQ_type: "warning"});
				return false;
			}
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: url,
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
						saveFile();//保存文件
						//设置处置收款表ID值
						if(!assDealRecAmtId && msg.data){
							$("#assDealRecAmt_id").val(msg.data);
						}
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
						//window.location.reload();
					}else{
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		}
		
		//设置显示/编辑属性
		function showOrEdit(){
	    	var flag = $("#flag").val();
			var buyerTypeCd = $("#buyerTypeCd").val();;
			//处置申请基础信息
			if(flag == "2"){//可编辑-发起人
				$("#dealCar_view").find(".edit_fqr").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#dealCar_view").find(".show_fqr").each(function (){
					$(this).addClass('Hide');
	        	});
				if(buyerTypeCd == "1"){//企业
					$("#dealCar_view").find(".person_edit").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#dealCar_view").find(".person_show").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#dealCar_view").find(".company_edit").each(function (){
						$(this).removeClass('Hide');
		        	});
					$("#dealCar_view").find(".company_show").each(function (){
						$(this).addClass('Hide');
		        	});
				}else if(buyerTypeCd == "2"){//个人
					$("#dealCar_view").find(".person_edit").each(function (){
						$(this).removeClass('Hide');
		        	});
					$("#dealCar_view").find(".person_show").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#dealCar_view").find(".company_edit").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#dealCar_view").find(".company_show").each(function (){
						$(this).addClass('Hide');
		        	});
				}
			}else{//不可编辑
				$("#dealCar_view").find(".edit_fqr").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#dealCar_view").find(".show_fqr").each(function (){
					$(this).removeClass('Hide');
	        	});
				//个人和企业信息-显示
				$("#dealCar_view").find(".person_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#dealCar_view").find(".company_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				if(buyerTypeCd == "1"){//企业
					$("#dealCar_view").find(".person_show").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#dealCar_view").find(".company_show").each(function (){
						$(this).removeClass('Hide');
		        	});
				}else if(buyerTypeCd == "2"){//个人
					$("#dealCar_view").find(".person_show").each(function (){
						$(this).removeClass('Hide');
		        	});
					$("#dealCar_view").find(".company_show").each(function (){
						$(this).addClass('Hide');
		        	});
				}
				liger.get("buyerTypeCd").setDisabled(true);//处置接受人类型
				liger.get("sellChannelCd").setDisabled(true);//处置路径
			}
			//付款和收款信息
			if(flag == "7"){//可编辑-通知打款
				$("#dealCar_view").find(".edit_tzdk").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#dealCar_view").find(".show_tzdk").each(function (){
					$(this).addClass('Hide');
	        	});
			}else{
				$("#dealCar_view").find(".edit_tzdk").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#dealCar_view").find(".show_tzdk").each(function (){
					$(this).removeClass('Hide');
	        	});
			}
			//实际到账信息
			if(flag == "8"){//可编辑-财务确认到账
				$("#dealCar_view").find(".edit_cwqr").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#dealCar_view").find(".show_cwqr").each(function (){
					$(this).addClass('Hide');
	        	});
			}else{
				$("#dealCar_view").find(".edit_cwqr").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#dealCar_view").find(".show_cwqr").each(function (){
					$(this).removeClass('Hide');
	        	});
				liger.get("isReceived").setDisabled(true);//未到账
			}
			//提车人信息
			if(flag == "7" || flag == "9"){//可编辑-通知打款/通知发起人处置结果,补充提车信息
				$("#dealCar_view").find(".edit_tcr").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#dealCar_view").find(".show_tcr").each(function (){
					$(this).addClass('Hide');
	        	});
				$(".saveBtn").removeClass('Hide');
			}else{
				$("#dealCar_view").find(".edit_tcr").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#dealCar_view").find(".show_tcr").each(function (){
					$(this).removeClass('Hide');
	        	});
				$(".saveBtn").addClass('Hide');
			}
			//是否隐藏：实际到账金额、实际到账时间
			if (isDetail && isDetail == '0') {
				$("#dealCar_view").find(".hide_abc").each(function (){
					$(this).addClass('Hide');
				});
			}
		}

		// 保存亏损原因
		function addAssDealSellLoss (){
            var taskNm = "${taskNm}";
            var wait_dialog;
            // 保存处置信息之前对亏损信息进行验证
            var chk_value = [];//定义一个数组
            $("input[name='lossCause']:checkbox").each(function () {//遍历每一个名字为nodes的复选框，其中选中的执行函数
                if ($(this).prev().attr('class').indexOf('l-checkbox-checked') !== -1) {
                    chk_value.push($(this).val());//将选中的值添加到数组chk_value中
                }
            });
            var costRem = $("#costRem").val();
            if (chk_value.length == 0) {
                $.ligerDialog.SQalert({content: "请选择亏损原因！", SQ_type: "error"});
                return;
            }
            for (var i = 0; i < chk_value.length; i++) {
                if (chk_value[i] != "" && "006" == chk_value[i] && costRem == "") {
                    $.ligerDialog.SQalert({content: "请添加备注信息！", SQ_type: "error"});
                    return;
                }
            }
             $.ajax({
                 type: 'post',
                    dataType:'json',
                    data:{lossCauseCdList:JSON.stringify(chk_value),taskNm:taskNm,costRem:costRem},
                    url:'<%=path%>/ass/assTrailCarD/addAssDealSellLoss.do?dataId='+$("#deal_Id").val(),
                    beforeSend: function(){
                          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                     },
                     success:function(msg){
                         wait_dialog.close();
                         if(msg.success == 1){
                             $.ligerDialog.SQalert({content:"保存成功！", SQ_type: "success"});
                         }else{
                             $.ligerDialog.SQalert({content:"保存失败！", SQ_type: "error"});
                         }
                }
             });
		}

		//初始化付款信息
		var grid = $("#ligergrid2").ligerGrid({
            url: '<%=path%>/ass/assTrailCarM/getAssDealRecAmtList.do?flag=1&dataTypeCd=1&dataId='+$("#deal_Id").val(),
            method: 'get',
            columns: [
                {display: '银行信息', name: 'payerBankNm', minWidth: 120, align: 'center', enabledSort: false},
                {display: '账号信息', name: 'payerAccNo', minWidth: 100, align: 'center', enabledSort: false},
                {display: '付款方名称', name: 'payerAccNm', minWidth: 150, align: 'center', enabledSort: false},
                {display: '付款金额(元)', name: 'payAmt', minWidth: 150, align: 'center', enabledSort: false,
					render: function (rowdata, rowindex, value, column) { 
						var h = rowdata.payAmt / 100;
						return h;
					}},
                {display: '使用金额(元)', name: 'useAmt', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, rowindex, value, column) {
                        var h = rowdata.useAmt / 100;
                        return h;
                    }},
				{display: '付款时间', name: 'payTm', width: 100, align:'center', enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = renderDate1(rowdata.payTm);
						return h;
					}},
				{display: '到账时间', name: 'receivedTm', width: 100, align:'center', enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = renderDate1(rowdata.receivedTm);
						return h;
					}},
                {display: '到账金额(元)', name: 'receivedAmt', minWidth: 150, align: 'center', enabledSort: false,
					render: function (rowdata, rowindex, value, column) { 
						var h = rowdata.receivedAmt / 100;
						return h;
					}},
                {display: '操作', name: '', minWidth: 150, align: 'center', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                    	var h='';
                        if('${flag}' == '7' || '${flag}' == '18'|| '${flag}' == '8'){//发起人/财务
							h+='<a class="sq-button-hasicon ' + l_hidden + '" style="cursor:pointer;" href="javascript:editPayInfo(';
							h+="'"+rowdata.id+"'";
							h+=')"><i class="sqBtnIco_4"></i>修改</a>';
							if('${flag}' == '7'|| '${flag}' == '18'){//发起人通知打款
								h+='<a class="sq-button-hasicon" style="cursor:pointer;" href="javascript:deletePayInfo(';
								h+="'"+rowdata.id+"'";
								h+=')"><i class="sqBtnIco_7"></i>删除</a>';
							}else{
								h+='<font class="sq-button-hasicon" color="c9c9c9"><i class="sqBtnIco_7"></i>删除</font>';
							}
						}else{
                          	h+='<font class="sq-button-hasicon" color="c9c9c9"><i class="sqBtnIco_4"></i>修改</font>';
                          	h+='<font class="sq-button-hasicon" color="c9c9c9"><i class="sqBtnIco_7"></i>删除</font>';
    					}
						return h;
                    }
                },
            ],
            //pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            heightDiff: -2,
            checkbox: true,
	        usePager: false,//是否分页
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
            onSelectRow: function (rowdata,rowNum,rowEl) {
                $.extend(true, pageInApp, {seletedCompRow: rowdata});
            },
            onUnSelectRow: function (rowdata) {
                $.extend(true, pageInApp, {seletedCompRow: null});
            }
        });
        //添加付款信息
        function editPayInfo(id){
        	var param = id+"&dataId="+$("#deal_Id").val()+"&flag="+$("#flag").val()+"&goFlag=2";
			$.ligerDialog.open({
                width:800,
                height: 260,
                title: '编辑付款信息',
                url: '<%=path%>/ass/assTrailCarD/toRecAmtPage.do?assDealRecAmt_id='+param
			});
		}
      	//删除付款信息
   	    function deletePayInfo(id){
	   	    $.ligerDialog.confirm("是否确认删除选中的付款信息数据?", function (flag) {
	            if (flag == false)return;
	            var wait_dialog = null;
	            $.ajax({
	                type: 'post',
	                dataType: 'json',
	                data: {id: id},
	                url: '<%=path%>/ass/assTrailCarD/deleteRecAmt.do',
	                beforeSend: function () {
	                    wait_dialog = $.ligerDialog.SQalert({
	                        content: LogUtils.LOG_CMM_DATA_LOADING,
	                        SQ_type: "waitting"
	                    });
	                },
	                success: function (msg) {
	                    wait_dialog.close();
	                    if (msg.success == 1) {
	                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
	                        grid.reload();
	                    } else {
	                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
	                    }
	                }
	            });
	        });
   	    }
    </script>
</body>
</html>